package org.csu.group4.jpetstore.persistence;

import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Select;
import org.csu.group4.jpetstore.mybatis.entity.Item;
import org.csu.group4.jpetstore.mybatis.entity.Product;
import org.springframework.stereotype.Component;

import java.util.List;

@Mapper
@Component
public interface ProductDAO {
    @Select("select * from product where category=#{categoryId}")
    List<Product> getProductListByCategory(String categoryId);

    @Insert("insert product(productid, category_id, name, descn) values (#{productid},#{category.id},#{name},#{descn}")
    void addProduct(Product product);

    @Select("select * from product where productid = #{productId}")
    Product getProduct(String productId);

    @Select("Select(select * from product where name like #{keyword})")
    List<Product> searchProductList(String keywords);

    @Select("select * from product where lower(name) like #{value}")
    List<Product> SearchProduct(String value);
}
